04. Using RBAC in Flask
Using RBAC in Flask
Extending our
@requires_auth
Decorator
ND004 C03 L04 A04 Using RBAC In Flask 1
For clarity, here is the complete
check_permissions
method:
def check_permissions(permission, payload):
if 'permissions' not in payload:
raise AuthError({
'code': 'invalid_claims',
'description': 'Permissions not included in JWT.'
}, 400)
if permission not in payload['permissions']:
raise AuthError({
'code': 'unauthorized',
'description': 'Permission not found.'
}, 403)
return True
Try it Yourself!
Task Description:
Follow along and run the code on your local machine:
Task Feedback:
Well done!